In the related art, in systems or the like for transmitting bit streams of moving images, or recording the bit streams onto recording media, high-efficiency coding is carried out to make efficient use of the transmission path or the recording capacity. In image coding apparatuses realizing this, the coding bit rate of a bit stream generated at the encoder is made constant in conformity with the transfer rate of the transmission medium, and the size of generated data, that is, the quantization step for quantization at the encoder is controlled under this constraint. That is, for example, if there is a succession of images with complex patterns, the quantization step is made larger to limit the size of generated data. Conversely, if there is a succession of simple patterns, the quantization step is made smaller to increase the size of generated data, thereby maintaining a fixed rate while preventing an overflow or underflow of the buffer memory from occurring.
Consequently, in image coding apparatuses according to the related art as mentioned above, the quantization step becomes large and image quality is degraded when there is a succession of complex images, and the quantization step becomes small when there is a succession of simple images, making it impossible to obtain a uniform image quality throughout. In view of this problem, for example, in Patent Document 1, an image coding apparatus is disclosed with which, in accordance with the ratio of the coding complexity of each GOP (Group of Pictures) to the total sum of the coding complexities of a plurality of GOPs, allocated code sizes allocated to individual GOPs themselves are calculated in such a way that large allocations are made to GOPs containing images with complex patterns, and small allocations are made to GOPs containing images with simple patterns.
On the other hand, for example, the step2 of TM5 (test model 5) is well known as a method for matching a generated code size to a target code size given to one picture. This is a technique with which a code size allocated to a picture is distributed uniformly over macro blocks (MBs) to find a target code size for each MB, and feed back control is applied within the picture to achieve a match to the target code size.    Patent Document 1: Japanese Patent No. 3358620
However, with the above-described method of the step2 of TM5, there are cases in which when encoding the first picture of a sequence or a picture immediately following a scene change, the initial value of quantization step does not match the pattern of that picture, resulting in degradation of image quality.
For example, if the quantization step is too large in a portion of the feed back control prior to following the pattern, the image quality of that portion is degraded compared with other portions. If the quantization step is too small, too much code size is used in that portion, which may even affect other portions.
In addition, since the target code size for each MB is set constant at all times, the code size distribution becomes inappropriate in cases such as when there is an unbalance in intra image complexity. Accordingly, it is desirable for the image coding apparatus to execute coding in parallel in advance to predict a generated code size, and match the generated code size to a target code size given to one picture, without performing intra feed back control. However, if the image coding apparatus is to execute quantization in parallel for the number of quantization parameters, the circuit scale becomes disadvantageously large.